<template>
	<view class="content">
		<image mode="widthFix"
			src="http://p1.meituan.net/hotel/b7f64dcbdbbcc0d740b535b8ed7b3a37_1_b8eb8f1aa8e3ef7a_1_xexu742UzdQsYUb+BL05f80ZmgRqy/9mh/r6iaP30j2pyJSyQxu+vhKxdUcHCbTubPmhUZYOTASMmTyjlpF64vyPND+LW1FRla2XkwtVA2xRzhsfEpqkuBIhkaxpUZ+o"
			class="top-bg"></image>
		<view class="detail-block">
			<view class="name">{{detail.name}}</view>
			<view class="label-block">
				<view v-for="(item,index) in detail.label" class="label-item">{{item}}</view>
			</view>
			<view class="price-block">
				<view class="price">￥{{detail.price}}</view>
				<view class="sold">已售{{detail.sold}}</view>
			</view>
		</view>
		<view class="date-block">
			<view class="title">选择日期</view>
			<view class="date-content">
				<view v-for="(item,index) in date" :key="item.id" @click="dateActive=index"
					:class="dateActive==index?'active':''" class="date-item">
					<view class="date">{{item.date}}</view>
				</view>
			</view>
		</view>
		<view class="evaluation-block">
			<view class="title-block">
				<view class="title">评价</view>
				<view class="more">查看全部<view class="iconfont icon-youjiantou"></view>
				</view>
			</view>
			<view class="evaluation-content">
				<view v-for="(item,index) in detail.evaluation" :key="item.id" class="evaluation-item">
					<view class="user-block">
						<image :src="item.photo" class="user-photo"></image>
						<view class="user-name">{{item.name}}</view>
						<view class="time">{{item.date}}</view>
					</view>
					<view class="evaluation">{{item.evaluation}}</view>
				</view>
			</view>
		</view>
		<view class="block booking">
			<view class="btn1 btn">立即预订</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				detail: {
					id: 1,
					name: '【预约/代订】敦煌·畅玩鸣沙山-沙漠腹地深度穿越/小月牙泉穿越/沙漠团建预约/【骆驼骑行体验+ATV沙滩摩托+UTV全地形沙漠赛车+无人机航拍】',
					label: ['特色体验', '市区免费接送', '深度体验沙漠'],
					price: 50,
					sold: 12,
					evaluation: [{
							id: 1,
							name: '逃命的包子',
							photo: '/static/user_photo_default.png',
							date: '2022-06-08',
							evaluation: '很好玩很好玩很好玩很好玩很好玩很好玩很好玩'
						},
						{
							id: 2,
							name: '大麦',
							photo: '/static/user_photo_default.png',
							date: '2022-06-08',
							evaluation: '如果你发现手机不见了的话……'
						},
						{
							id: 3,
							name: '热心市民罗先生',
							photo: '/static/user_photo_default.png',
							date: '2022-06-08',
							evaluation: '但是下山有被爽到'
						},
						{
							id: 4,
							name: '小草莓',
							photo: '/static/user_photo_default.png',
							date: '2022-06-08',
							evaluation: '我能从沙子里刨出个手机'
						},
					]
				},
				date: [],
				dateActive: 0
			}
		},
		mounted() {
			let _this = this;
			let date = [];
			for (let i = 0; i < 8; i++) {
				let res = _this.utils.getCurrentTime('d', '/', i);
				res = res.slice(5);
				date.push({
					date: res
				})
			}
			this.date = date;
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		background: #F4F4F4;
		min-height: 100vh;
		padding-bottom: 140rpx;

		.top-bg {
			width: 100%;
			height: auto;
		}

		.detail-block {
			width: 100%;
			display: flex;
			flex-direction: column;
			background: #fff;
			margin-top: -120rpx;
			padding: 20rpx;

			.name {
				font-size: 34rpx;
				color: $color-primary-text;
				font-weight: bold;
				text-align: justify;
			}

			.label-block {
				display: flex;
				flex-direction: row;
				overflow-x: scroll;
				width: 100%;
				padding: 20rpx 0;

				.label-item {
					border-radius: 10rpx;
					color: $color-regular-text;
					font-size: 26rpx;
					padding: 10rpx 20rpx;
					background: $color-border-extralight;
					margin: 0 10rpx;
					flex: none;
				}
			}

			.price-block {
				display: flex;
				flex-direction: row;
				align-items: center;

				.price {
					color: $color-danger;
					font-size: 38rpx;
					flex-grow: 1;
				}

				.sold {
					flex-grow: 0;
					font-size: 24rpx;
					color: $color-secondary-text
				}
			}
		}

		.date-block {
			padding: 20rpx;
			background: #fff;
			margin-top: 20rpx;

			.title {
				font-size: 34rpx;
				font-weight: bold;
				padding-left: 10rpx;
			}

			.date-content {
				padding: 30rpx 0;
				display: flex;
				flex-direction: row;
				overflow-x: scroll;

				.date-item {
					display: flex;
					flex-direction: row;
					align-items: center;
					justify-content: center;
					background: #fff;
					padding: 20rpx 30rpx;
					margin: 0 10rpx;
					border: 1px solid #efefef;
					border-radius: 50rpx;
					flex: none;

					.date {
						font-weight: bold;
						font-size: 28rpx;
						margin-right: 10rpx;
					}

					.date.more {
						font-weight: normal;
					}
				}

				.date-item.active {
					border: 1px solid $color-primary;
					background: $color-primary;
					color: #fff;
				}
			}
		}

		.evaluation-block {
			display: flex;
			flex-direction: column;
			margin: 20rpx 0;
			background: #fff;
			padding: 30rpx 20rpx;
			padding-bottom: 0;

			.title-block {
				display: flex;
				flex-direction: row;
				align-items: center;
				padding-bottom: 30rpx;

				.title {
					font-size: 34rpx;
					flex-grow: 1;
					font-weight: bold;
					padding-left: 10rpx;
				}

				.more {
					display: flex;
					flex-direction: row;
					align-items: center;
					font-size: 28rpx;
					color: $color-secondary-text;

					.iconfont {
						margin-left: 8rpx;
						font-size: 24rpx;
					}
				}
			}

			.evaluation-content {
				display: flex;
				flex-direction: column;

				.evaluation-item {
					display: flex;
					flex-direction: column;
					border-bottom: 1px solid #efefef;

					.user-block {
						display: flex;
						flex-direction: row;
						align-items: center;
						height: 80rpx;

						.user-photo {
							width: 40rpx;
							height: 40rpx;
							border-radius: 50%;
							flex-grow: 0;
							margin-right: 20rpx;
						}

						.user-name {
							flex-grow: 1;
							font-size: 28rpx;
						}

						.time {
							flex-grow: 0;
							font-size: 28rpx;
							color: $color-secondary-text;
						}
					}

					.evaluation {
						padding-bottom: 20rpx;
					}
				}

				.evaluation-item:last-child {
					border: none;
				}
			}
		}

		.block.booking {
			width: 100%;
			position: fixed;
			bottom: 0;
			left: 0;
			height: 120rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			background: #fff;

			.btn {
				margin: 0;
				width: 400rpx;
				height: 80rpx;
				font-size: 28rpx;
			}
		}
	}
</style>
